extends c
extends base
extends math
extends tools
extends algorithm/graph
extends algorithm/search
extends algorithm/string
extends data_structure

snippet using "标准命名空间" b
using namespace ${1:std};
endsnippet

#=================================
#预处理
#=================================
# #include "..."
snippet INC
#include "${1:TODO}"${2}
endsnippet
# #include <...>
snippet inc
#include <${1:TODO}>${2}
endsnippet
#=================================
#结构语句
#=================================
# if
snippet if
if (${1:/* condition */}) {
    ${2:TODO}
}
endsnippet
# else if
snippet ei
else if (${1:/* condition */}) {
    ${2:TODO}
}
endsnippet
# else
snippet el
else {
    ${1:TODO}
}
endsnippet

# Do While Loop
snippet do
do {
    ${2:TODO}
} while (${1:/* condition */});
endsnippet
# While Loop
snippet wh
while (${1:/* condition */}) {
    ${2:TODO}
}
endsnippet
# switch
snippet sw
switch (${1:/* condition */}) {
    case ${2:c}: {
    }
    break;

    default: {
    }
    break;
}
endsnippet
# 通过迭代器遍历容器（可读写）
#snippet for
#for (auto ${2:iter} = ${1:c}.begin(); ${3:$2} != $1.end(); ${4:++iter}) {
#    ${5:TODO}
#}
#endsnippet
# 通过迭代器遍历容器（只读）
snippet cfor
for (auto ${2:citer} = ${1:c}.cbegin(); ${3:$2} != $1.cend(); ${4:++citer}) {
    ${5:TODO}
}
endsnippet
# 通过下标遍历容器
snippet For
for (decltype($1.size()) ${2:i} = 0; $2 != ${1}.size(); ${3:++}$2) {
    ${4:TODO}
}
endsnippet

# C++11风格for循环遍历（可读写）
snippet F
for (auto& e : ${1:c}) {
}
endsnippet
# C++11风格for循环遍历（只读）
snippet CF
for (const auto& e : ${1:c}) {
}
endsnippet
# For Loop
snippet FOR
for (unsigned ${2:i} = 0; $2 < ${1:count}; ${3:++}$2) {
    ${4:TODO}
}
endsnippet
# try-catch
snippet try
try {
} catch (${1:/* condition */}) {
}
endsnippet
snippet ca
catch (${1:/* condition */}) {
}
endsnippet
snippet throw
th (${1:/* condition */});
endsnippet

#=================================
#语言扩展
#=================================
# Class
snippet cl
class ${1:`Filename('$1_t', 'name')`}
{
    public:
        $1 ();
        virtual ~$1 ();

    private:
};
endsnippet


